package map;

import java.util.LinkedHashMap;
import java.util.Map;

public class LinkedHashMapTest {

    public static void main(String[] args) {
        //if access order is true, the latest access element will in the end when iterator
        Map<Integer, Integer> map = new LinkedHashMap<>(10, 0.75f, true);
        map.put(1, 1);
        map.put(2, 2);
        map.put(3, 3);
        map.put(4, 4);
        map.get(3);
        map.put(1, 10);
        //2 4 3 1
        for (Map.Entry<Integer, Integer> entry : map.entrySet()) {
            System.out.println(entry.getKey());
        }
    }

}
